package com.greateffect.littlebud.lib.provider;

import com.greateffect.littlebud.lib.utils.JListKit;

import java.util.List;
import java.util.Random;

import cn.jzvd.bean.MediaBean;

/**
 * Created by ZengCS on 2016/8/17.
 * E-mail:zengcs@vip.qq.com
 * Add:成都市天府软件园E3
 */
public class VideoProvider {
    private static final String[] PICS = {
            "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4",
            "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4",
            "https://media.w3.org/2010/05/sintel/trailer.mp4",
            "http://vfx.mtime.cn/Video/2019/02/04/mp4/190204084208765161.mp4",
            "http://vfx.mtime.cn/Video/2019/03/21/mp4/190321153853126488.mp4",
            "http://vfx.mtime.cn/Video/2019/03/19/mp4/190319222227698228.mp4",
            "http://vfx.mtime.cn/Video/2019/03/19/mp4/190319212559089721.mp4",
            "http://vfx.mtime.cn/Video/2019/03/18/mp4/190318231014076505.mp4",
            "http://vfx.mtime.cn/Video/2019/03/18/mp4/190318214226685784.mp4",
            "http://vfx.mtime.cn/Video/2019/03/19/mp4/190319104618910544.mp4",
            "http://vfx.mtime.cn/Video/2019/03/19/mp4/190319125415785691.mp4",
            "http://vfx.mtime.cn/Video/2019/03/17/mp4/190317150237409904.mp4",
            "http://vfx.mtime.cn/Video/2019/03/14/mp4/190314223540373995.mp4",
            "http://vfx.mtime.cn/Video/2019/03/14/mp4/190314102306987969.mp4",
            "http://vfx.mtime.cn/Video/2019/03/13/mp4/190313094901111138.mp4",
            "http://vfx.mtime.cn/Video/2019/03/12/mp4/190312143927981075.mp4",
            "http://vfx.mtime.cn/Video/2019/03/12/mp4/190312083533415853.mp4",
            "http://vfx.mtime.cn/Video/2019/03/09/mp4/190309153658147087.mp4",
            "https://vfx.mtime.cn/Video/2019/01/15/mp4/190115161611510728_480.mp4",
    };

    public static List<MediaBean> generateVideoList() {
        List<MediaBean> list = JListKit.newArrayList();
        for (String PIC : PICS) {
            list.add(new MediaBean(MediaBean.TYPE_VIDEO, PIC, "我是标题", PicProvider.get()));
        }
        return list;
    }

    private static Random random = new Random();
    private static int lastInt = -1;

    public static String getVideo() {
        int len = PICS.length;
        if (len == 1) {
            return PICS[0];
        }
        int i = random.nextInt(PICS.length);
        if (i == lastInt) {
            return getVideo();
        }
        lastInt = i;
        return PICS[i];
    }
}
